#!/bin/sh
# EloTiers Launcher start wrapper (Linux and macOS). Resolves its own location, even through symlinks.
self=$0
while [ -h "$self" ]; do
  link=$(readlink "$self")
  case $link in /*) self=$link ;; *) self=$(dirname "$self")/$link ;; esac
done
dir=$(cd "$(dirname "$self")" && pwd -P)
root=$(cd "$dir/../Resources" && pwd -P)
[ -x "$root/runtime/bin/java" ] || { echo "EloTiers Launcher: Java runtime missing in $root/runtime" >&2; exit 1; }
# ELOTIERS_JAVA_OPTS lets tests and power users add JVM options, e.g. -Delotiers.nowindow=true
# shellcheck disable=SC2086
exec "$root/runtime/bin/java" -Xmx64m --enable-native-access=ALL-UNNAMED --enable-native-access=ALL-UNNAMED "-Xdock:name=EloTiers Launcher" "-Xdock:icon=$root/elotiers.png" $ELOTIERS_JAVA_OPTS "-Delotiers.install=$root" -jar "$root/bootstrap.jar" "$@"
